import java.util.ArrayList;


public class Tester {

	public static void runSelfTest(){
		doSelfTestOfDeadLockFunction();
//		doSelfTestofPossibleMoveFunction();
//		doSelfTestSolver();
//		doSelfTestPossibleMoveBox();
	}
	
	public static void doSelfTestPossibleMoveBox(){
		Board board = new Board(8, 8);
		for ( int x = 0 ; x < 8 ; x++){
			for ( int y = 0; y < 8 ; y++){
				board.setData(x, y, Board.WALL);
			}
		}
		board.setData(1, 1, Board.EMPTY);
		board.setData(1, 2, Board.EMPTY);
		board.setData(1, 3, Board.EMPTY);
		board.setData(1, 4, Board.EMPTY);
		board.setData(1, 5, Board.EMPTY);
		board.setData(2, 1, Board.EMPTY);
		board.setData(2, 2, Board.EMPTY);
		board.setData(2, 3, Board.EMPTY);
		board.setData(2, 4, Board.EMPTY);
		board.setData(2, 5, Board.EMPTY);
		board.setData(3, 1, Board.EMPTY);
		board.setData(3, 2, Board.EMPTY);
		board.setData(3, 3, Board.EMPTY);
		board.setData(3, 4, Board.EMPTY);
		board.setData(3, 5, Board.EMPTY);
		board.setData(4, 1, Board.EMPTY);
		board.setData(4, 2, Board.EMPTY);
		board.setData(4, 3, Board.EMPTY);
		board.setData(4, 4, Board.EMPTY);
		board.setData(4, 5, Board.EMPTY);
		
		ArrayList<Position> boxes = new ArrayList<Position>();
		boxes.add(new Position(1,2));
		PlayerNBoxes pnb = new PlayerNBoxes(new Position(3,3), boxes);
		
		ArrayList<Move> exp = new ArrayList<Move>();
		exp.add(new Move(new Position(1,2), new Position(1,3)));
		exp.add(new Move(new Position(1,2), new Position(1,1)));
		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
		System.out.println("1. possible move BOX test passed?: "+ testPossibleMoveBoxFunction(board, pnb, exp));
		System.out.println(" ############################ \n ");
		
		
		
	}
	
//	public static void doSelfTestSolver(){
//		Board board = new Board(6, 6);
//		for ( int x = 0 ; x < 6 ; x++){
//			for ( int y = 0; y < 6 ; y++){
//				board.setData(x, y, Board.WALL);
//			}
//		}
//		board.setData(1, 1, Board.EMPTY);
//		board.setData(1, 2, Board.EMPTY);
//		board.setData(1, 3, Board.EMPTY);
//		board.setData(1, 4, Board.EMPTY);
////		board.setData(1, 5, Board.EMPTY);
//		board.setData(2, 1, Board.EMPTY);
//		board.setData(2, 2, Board.EMPTY);
//		board.setData(2, 3, Board.EMPTY);
//		board.setData(2, 4, Board.EMPTY);
////		board.setData(2, 5, Board.EMPTY);
//		board.setData(3, 1, Board.EMPTY);
//		board.setData(3, 2, Board.EMPTY);
//		board.setData(3, 3, Board.EMPTY);
//		board.setData(3, 4, Board.EMPTY);
////		board.setData(3, 5, Board.EMPTY);
//		board.setData(4, 1, Board.EMPTY);
//		board.setData(4, 2, Board.EMPTY);
//		board.setData(4, 3, Board.EMPTY);
//		board.setData(4, 4, Board.EMPTY);
////		board.setData(4, 5, Board.EMPTY);
//		
//		board.setData(4,4, Board.GOAL);
//		board.setData(1,2, Board.GOAL);
//		ArrayList<Position> boxes = new ArrayList<Position>();
//		boxes.add(new Position(3,2));
//		boxes.add(new Position(3,3));
//		PlayerNBoxes pnb = new PlayerNBoxes(new Position(4,3), boxes);
//		
//		byte [][] jointedBoard = Helper.joinBoards(board, pnb);
//        Solver sol = new Solver(board);
//        String solution = sol.solve(pnb);
//        solution = sol.inverseString(solution);
//        if ( solution.equals("")){
//        	System.out.println(" NO SOLUTION FOUND!!");
//        	return;
//        }
//        System.out.println("Solution: "+solution);
//        System.out.println(" for:\n "+Board.toString(jointedBoard, 6, 6));
//            
//        
//	}
//	
//	
//	
	public static void doSelfTestOfDeadLockFunction(){
			
		Board board = new Board(8, 8);
		for ( int x = 0 ; x < 8 ; x++){
			for ( int y = 0; y < 8 ; y++){
				board.setData(x, y, Board.WALL);
			}
		}
		board.setData(1, 1, Board.EMPTY);
		board.setData(1, 2, Board.EMPTY);
		board.setData(1, 3, Board.EMPTY);
		board.setData(1, 4, Board.EMPTY);
		board.setData(1, 5, Board.EMPTY);
		board.setData(2, 1, Board.EMPTY);
		board.setData(2, 2, Board.EMPTY);
		board.setData(2, 3, Board.EMPTY);
		board.setData(2, 4, Board.EMPTY);
		board.setData(2, 5, Board.EMPTY);
		board.setData(3, 1, Board.EMPTY);
		board.setData(3, 2, Board.EMPTY);
		board.setData(3, 3, Board.EMPTY);
		board.setData(3, 4, Board.EMPTY);
		board.setData(3, 5, Board.EMPTY);
		board.setData(4, 1, Board.EMPTY);
		board.setData(4, 2, Board.EMPTY);
		board.setData(4, 3, Board.EMPTY);
		board.setData(4, 4, Board.EMPTY);
		board.setData(4, 5, Board.EMPTY);
		
		ArrayList<Position> boxes = new ArrayList<Position>();
		boxes.add(new Position(1,1));
		PlayerNBoxes pnb = new PlayerNBoxes(new Position(3,3), boxes);
//		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
//		System.out.println("1. deadlock test passed?: "+ testIsItADeadLockFunction(board, pnb, true));
//		System.out.println(" ############################ \n ");
//		
//		boxes.clear();
//		boxes.add(new Position(1,4));
//		boxes.add(new Position(1,3));
//		PlayerNBoxes pnb2 = new PlayerNBoxes(new Position(4,4), boxes);
//		System.out.println(Board.toString(Helper.joinBoards(board, pnb2),8,8));
//		System.out.println("2. deadlock test passed?: "+ testIsItADeadLockFunction(board, pnb2, true));
//		System.out.println(" ############################ \n ");
//		
//		boxes.clear();
//		boxes.add(new Position(4,2));
//		boxes.add(new Position(4,3));
//		pnb.setBoxes(boxes);
//		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
//		System.out.println("3. deadlock test passed?: "+ testIsItADeadLockFunction(board, pnb, true));
//		System.out.println(" ############################ \n ");
//		
//		boxes.clear();
//		boxes.add(new Position(2,1));
//		boxes.add(new Position(3,1));
//		pnb.setBoxes(boxes);
//		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
//		System.out.println("4. deadlock test passed?: "+ testIsItADeadLockFunction(board, pnb, true));
//		System.out.println(" ############################ \n ");
//		
//		boxes.clear();
//		boxes.add(new Position(2,1));
//		boxes.add(new Position(2,2));
//		pnb.setBoxes(boxes);
//		board.setData(3, 2, Board.WALL);
//		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
//		System.out.println("5. deadlock test passed?: "+ testIsItADeadLockFunction(board, pnb, false));
//		System.out.println(" ############################ \n ");
//
//		boxes.clear();
//		boxes.add(new Position(2,1));
//		boxes.add(new Position(2,2));
//		pnb.setBoxes(boxes);
//		board.setData(3, 2, Board.WALL);
//		board.setData(1, 2, Board.WALL);
//		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
//		System.out.println("6. deadlock test passed?: "+ testIsItADeadLockFunction(board, pnb, false));
//		System.out.println(" ############################ \n ");
//
//		boxes.clear();
//		boxes.add(new Position(2,3));
//		boxes.add(new Position(3,3));
//		pnb.setBoxes(boxes);
//		pnb.setPlayer(new Position(1,1));
//		board.setData(3, 2, Board.WALL);
//		board.setData(2, 4, Board.WALL);
//		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
//		System.out.println("7. deadlock test passed?: "+ testIsItADeadLockFunction(board, pnb, true));
//		System.out.println(" ############################ \n ");
//
//		
//		boxes.clear();
//		boxes.add(new Position(2,2));
//		boxes.add(new Position(2,3));
//		pnb.setBoxes(boxes);
//		pnb.setPlayer(new Position(1,1));
//		board.setData(3, 2, Board.WALL);
//		board.setData(2, 4, Board.WALL);
//		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
//		System.out.println("8. deadlock test passed?: "+ testIsItADeadLockFunction(board, pnb, false));
//		System.out.println(" ############################ \n ");
//		
//		
//		boxes.clear();
//		board.setData(3, 2, Board.EMPTY);
//		board.setData(2, 4, Board.EMPTY);
//		board.setData(1, 2, Board.EMPTY);
//		board.setData(3, 1, Board.WALL);
//		board.setData(2, 3, Board.WALL);
//		boxes.add(new Position(2,2));
//		boxes.add(new Position(3,2));
//		pnb.setBoxes(boxes);
//		pnb.setPlayer(new Position(1,1));
//
//		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
//		System.out.println("9. deadlock test passed?: "+ testIsItADeadLockFunction(board, pnb, true));
//		System.out.println(" ############################ \n ");
//		
//		boxes.clear();
//		board.setData(3, 3, Board.WALL);
//		board.setData(3, 1, Board.WALL);
//		board.setData(2, 3, Board.EMPTY);
//		boxes.add(new Position(2,2));
//		boxes.add(new Position(3,2));
//		pnb.setBoxes(boxes);
//		pnb.setPlayer(new Position(1,1));
//
//		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
//		System.out.println("10. deadlock test passed?: "+ testIsItADeadLockFunction(board, pnb, false));
//		System.out.println(" ############################ \n ");
//		
//		boxes.clear();
//		board.setData(3, 3, Board.EMPTY);
//		board.setData(3, 1, Board.EMPTY);
//		boxes.add(new Position(1,3));
//		pnb.setBoxes(boxes);
//		pnb.setPlayer(new Position(2,2));
//
//		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
//		System.out.println("11. deadlock test passed?: "+ testIsItADeadLockFunction(board, pnb, true));
//		System.out.println(" ############################ \n ");
		
		
		boxes.clear();
		board.setData(1, 4, Board.WALL);
		board.setData(1, 5, Board.WALL);
		boxes.add(new Position(2,4));
		pnb.setBoxes(boxes);
		pnb.setPlayer(new Position(2,2));

		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
		System.out.println("12. deadlock test passed?: "+ testIsItADeadLockFunction(board, pnb, false));
		System.out.println(" ############################ \n ");
		
		
		
		boxes.clear();
		board.setData(1, 2, Board.WALL);
		boxes.add(new Position(2,4));
		pnb.setBoxes(boxes);
		pnb.setPlayer(new Position(2,2));

		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
		System.out.println("13. deadlock test passed?: "+ testIsItADeadLockFunction(board, pnb, false));
		System.out.println(" ############################ \n ");
		
		
		boxes.clear();
		board.setData(2, 1, Board.GOAL);
		boxes.add(new Position(2,4));
		pnb.setBoxes(boxes);
		pnb.setPlayer(new Position(2,2));

		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
		System.out.println("14. deadlock test passed?: "+ testIsItADeadLockFunction(board, pnb, false));
		System.out.println(" ############################ \n ");
		
		boxes.clear();
		board.setData(2, 1, Board.EMPTY);
		board.setData(1, 1, Board.GOAL);
		boxes.add(new Position(2,4));
		pnb.setBoxes(boxes);
		pnb.setPlayer(new Position(2,2));

		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
		System.out.println("15. deadlock test passed?: "+ testIsItADeadLockFunction(board, pnb, false));
		System.out.println(" ############################ \n ");
		
		boxes.clear();
		board.setData(2, 5, Board.GOAL);
		board.setData(1, 1, Board.EMPTY);
		boxes.add(new Position(2,4));
		pnb.setBoxes(boxes);
		pnb.setPlayer(new Position(2,2));

		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
		System.out.println("16. deadlock test passed?: "+ testIsItADeadLockFunction(board, pnb, false));
		System.out.println(" ############################ \n ");
		
		boxes.clear();
		board.setData(2, 5, Board.EMPTY);
		board.setData(1, 2, Board.EMPTY);
		board.setData(1, 4, Board.EMPTY);
		board.setData(1, 5, Board.EMPTY);
		boxes.add(new Position(3,1));
		pnb.setBoxes(boxes);
		pnb.setPlayer(new Position(2,2));

		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
		System.out.println("17. deadlock test passed?: "+ testIsItADeadLockFunction(board, pnb, true));
		System.out.println(" ############################ \n ");
		
		boxes.clear();
		board.setData(3, 1, Board.WALL);
		board.setData(4, 1, Board.WALL );
		boxes.add(new Position(3,2));
		pnb.setBoxes(boxes);
		pnb.setPlayer(new Position(2,2));

		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
		System.out.println("18. deadlock test passed?: "+ testIsItADeadLockFunction(board, pnb, false));
		System.out.println(" ############################ \n ");
		
		boxes.clear();
		board.setData(1, 1, Board.WALL);
		boxes.add(new Position(3,2));
		pnb.setBoxes(boxes);
		pnb.setPlayer(new Position(2,2));

		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
		System.out.println("19. deadlock test passed?: "+ testIsItADeadLockFunction(board, pnb, false));
		System.out.println(" ############################ \n ");
		
		boxes.clear();
		board.setData(2, 1, Board.GOAL);
		boxes.add(new Position(3,2));
		pnb.setBoxes(boxes);
		pnb.setPlayer(new Position(2,2));

		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
		System.out.println("20. deadlock test passed?: "+ testIsItADeadLockFunction(board, pnb, false));
		System.out.println(" ############################ \n ");
		
		boxes.clear();
		board.setData(2, 1, Board.EMPTY);
		board.setData(1, 2, Board.GOAL);
		boxes.add(new Position(3,2));
		pnb.setBoxes(boxes);
		pnb.setPlayer(new Position(2,2));

		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
		System.out.println("21. deadlock test passed?: "+ testIsItADeadLockFunction(board, pnb, false));
		System.out.println(" ############################ \n ");
		
		boxes.clear();
		board.setData(1, 2, Board.EMPTY);
		board.setData(1, 1, Board.EMPTY);
		board.setData(3, 1, Board.EMPTY);
		board.setData(4, 1, Board.EMPTY);

		boxes.add(new Position(2,4));
		boxes.add(new Position(3,3));
		boxes.add(new Position(3,4));
		boxes.add(new Position(2,3));
		pnb.setBoxes(boxes);
		pnb.setPlayer(new Position(1,1));

		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
		System.out.println("22. deadlock test passed?: "+ testIsItADeadLockFunction(board, pnb, true, 0));
		System.out.println(" ############################ \n ");
		
		System.out.println("23. deadlock test passed?: "+ testIsItADeadLockFunction(board, pnb, true, 1));
		System.out.println(" ############################ \n ");
		
		System.out.println("24. deadlock test passed?: "+ testIsItADeadLockFunction(board, pnb, true, 2));
		System.out.println(" ############################ \n ");
		
		System.out.println("25. deadlock test passed?: "+ testIsItADeadLockFunction(board, pnb, true, 3));
		System.out.println(" ############################ \n ");
		
		
		
	}
//	
//	
//	public static void doSelfTestofPossibleMoveFunction(){
//		Board board = new Board(8, 8);
//		for ( int x = 0 ; x < 8 ; x++){
//			for ( int y = 0; y < 8 ; y++){
//				board.setData(x, y, Board.WALL);
//			}
//		}
//		board.setData(1, 1, Board.EMPTY);
//		board.setData(1, 2, Board.EMPTY);
//		board.setData(1, 3, Board.EMPTY);
//		board.setData(1, 4, Board.EMPTY);
//		board.setData(1, 5, Board.EMPTY);
//		board.setData(2, 1, Board.EMPTY);
//		board.setData(2, 2, Board.EMPTY);
//		board.setData(2, 3, Board.EMPTY);
//		board.setData(2, 4, Board.EMPTY);
//		board.setData(2, 5, Board.EMPTY);
//		board.setData(3, 1, Board.EMPTY);
//		board.setData(3, 2, Board.EMPTY);
//		board.setData(3, 3, Board.EMPTY);
//		board.setData(3, 4, Board.EMPTY);
//		board.setData(3, 5, Board.EMPTY);
//		board.setData(4, 1, Board.EMPTY);
//		board.setData(4, 2, Board.EMPTY);
//		board.setData(4, 3, Board.EMPTY);
//		board.setData(4, 4, Board.EMPTY);
//		board.setData(4, 5, Board.EMPTY);
//		
//		ArrayList<Position> boxes = new ArrayList<Position>();
//		boxes.add(new Position(1,2));
//		PlayerNBoxes pnb = new PlayerNBoxes(new Position(3,3), boxes);
//		
//		ArrayList<Position> exp = new ArrayList<Position>();
////		exp.add(new Position(2,3));
////		exp.add(new Position(4,3));
////		exp.add(new Position(3,2));
////		exp.add(new Position(3,4));
////		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
////		System.out.println("1. possible moves test passed?: "+ testPossibleMovesFunction(board, pnb, exp));
////		System.out.println(" ############################ \n ");
////		
////		exp.clear();
////		board.setData(3, 2, Board.WALL);
////		exp.add(new Position(2,3));
////		exp.add(new Position(4,3));
////		exp.add(new Position(3,4));
////		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
////		System.out.println("2. possible moves test passed?: "+ testPossibleMovesFunction(board, pnb, exp));
////		System.out.println(" ############################ \n ");
////		
////		exp.clear();
////		board.setData(3, 2, Board.EMPTY);
////		board.setData(3, 4, Board.WALL);
////		exp.add(new Position(2,3));
////		exp.add(new Position(4,3));
////		exp.add(new Position(3,2));
////		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
////		System.out.println("3. possible moves test passed?: "+ testPossibleMovesFunction(board, pnb, exp));
////		System.out.println(" ############################ \n ");
////		
////		exp.clear();
////		board.setData(2, 3, Board.WALL);
////		board.setData(3, 4, Board.EMPTY);
////		exp.add(new Position(4,3));
////		exp.add(new Position(3,2));
////		exp.add(new Position(3,4));
////		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
////		System.out.println("4. possible moves test passed?: "+ testPossibleMovesFunction(board, pnb, exp));
////		System.out.println(" ############################ \n ");
////		
////		exp.clear();
////		board.setData(2, 3, Board.EMPTY);
////		board.setData(4, 3, Board.WALL);
////		exp.add(new Position(2,3));
////		exp.add(new Position(3,2));
////		exp.add(new Position(3,4));
////		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
////		System.out.println("5. possible moves test passed?: "+ testPossibleMovesFunction(board, pnb, exp));
////		System.out.println(" ############################ \n ");
////		
////		board.setData(4, 3, Board.EMPTY);
////		exp.clear();
////		pnb.setPlayer(new Position(4,1));
////		exp.add(new Position(3,1));
////		exp.add(new Position(4,2));
////		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
////		System.out.println("6. possible moves test passed?: "+ testPossibleMovesFunction(board, pnb, exp));
////		System.out.println(" ############################ \n ");
////		
////		exp.clear();
////		pnb.setPlayer(new Position(4,5));
////		exp.add(new Position(3,5));
////		exp.add(new Position(4,4));
////		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
////		System.out.println("7. possible moves test passed?: "+ testPossibleMovesFunction(board, pnb, exp));
////		System.out.println(" ############################ \n ");
////		
////		exp.clear();
////		pnb.setPlayer(new Position(1,5));
////		exp.add(new Position(2,5));
////		exp.add(new Position(1,4));
////		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
////		System.out.println("8. possible moves test passed?: "+ testPossibleMovesFunction(board, pnb, exp));
////		System.out.println(" ############################ \n ");
////		
////		
////		exp.clear();
////		pnb.setPlayer(new Position(1,1));
////		exp.add(new Position(2,1));
////		exp.add(new Position(1,2));
////		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
////		System.out.println("9. possible moves test passed?: "+ testPossibleMovesFunction(board, pnb, exp));
////		System.out.println(" ############################ \n ");
////		
////		exp.clear();
////		pnb.setPlayer(new Position(1,3));
////		exp.add(new Position(2,3));
////		exp.add(new Position(1,4));
////		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
////		System.out.println("10. possible moves test passed?: "+ testPossibleMovesFunction(board, pnb, exp));
////		System.out.println(" ############################ \n ");
////		
////		
////		exp.clear();
////		boxes.clear();
////		boxes.add(new Position(2, 2));
////		boxes.add(new Position(3, 2));
////
////		pnb = new PlayerNBoxes(new Position(4, 2), boxes);
////		exp.add(new Position(4,1));
////		exp.add(new Position(4,3));
////		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
////		System.out.println("11. possible moves test passed?: "+ testPossibleMovesFunction(board, pnb, exp));
////		System.out.println(" ############################ \n ");
////
////		exp.clear();
////		boxes.clear();
////		boxes.add(new Position(2, 2));
////		boxes.add(new Position(3, 2));
////
////		pnb = new PlayerNBoxes(new Position(1, 2), boxes);
////		exp.add(new Position(1,1));
////		exp.add(new Position(1,3));
////		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
////		System.out.println("12. possible moves test passed?: "+ testPossibleMovesFunction(board, pnb, exp));
////		System.out.println(" ############################ \n ");
////		
////		
////		exp.clear();
////		boxes.clear();
////		boxes.add(new Position(2, 2));
////		boxes.add(new Position(2, 3));
////
////		pnb = new PlayerNBoxes(new Position(2, 4), boxes);
////		exp.add(new Position(1,4));
////		exp.add(new Position(3,4));
////		exp.add(new Position(2,5));
////		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
////		System.out.println("13. possible moves test passed?: "+ testPossibleMovesFunction(board, pnb, exp));
////		System.out.println(" ############################ \n ");
////
////		exp.clear();
////		boxes.clear();
////		boxes.add(new Position(2, 2));
////		boxes.add(new Position(2, 3));
////
////		pnb = new PlayerNBoxes(new Position(2, 1), boxes);
////		exp.add(new Position(1,1));
////		exp.add(new Position(3,1));
////		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
////		System.out.println("14. possible moves test passed?: "+ testPossibleMovesFunction(board, pnb, exp));
////		System.out.println(" ############################ \n ");
////		
////		
////		exp.clear();
////		boxes.clear();
////		boxes.add(new Position(2, 2));
////		boxes.add(new Position(2, 3));
////		board.setData(1,2,Board.WALL);
////
////		pnb = new PlayerNBoxes(new Position(3, 3), boxes);
////		exp.add(new Position(4,3));
////		exp.add(new Position(3,2));
////		exp.add(new Position(3,4));
////		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
////		System.out.println("15. possible moves test passed?: "+ testPossibleMovesFunction(board, pnb, exp));
////		System.out.println(" ############################ \n ");
//		
////		exp.clear();
////		boxes.clear();
////		boxes.add(new Position(2, 2));
////		board.setData(1,2,Board.EMPTY);
////		board.setData(1,1,Board.GOAL);
////
////		pnb = new PlayerNBoxes(new Position(3, 2), boxes);
////		exp.add(new Position(4,2));
////		exp.add(new Position(3,1));
////		exp.add(new Position(3,3));
////		exp.add(new Position(2,2));
////		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
////		System.out.println("15. possible moves test passed?: "+ testPossibleMovesFunction(board, pnb, exp));
////		System.out.println(" ############################ \n ");
//		
////		exp.clear();
////		boxes.clear();
////		boxes.add(new Position(2, 5));
////		board.setData(1,1,Board.EMPTY);
////		board.setData(4,5,Board.GOAL);
////		
////		pnb = new PlayerNBoxes(new Position(1, 5), boxes);
////		exp.add(new Position(1,4));
////		exp.add(new Position(2,5));
////		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
////		System.out.println("16. possible moves test passed?: "+ testPossibleMovesFunction(board, pnb, exp));
////		System.out.println(" ############################ \n ");
////		
////		exp.clear();
////		boxes.clear();
////		boxes.add(new Position(3, 5));
////		board.setData(3,5,Board.GOAL);
////		board.setData(2,5,Board.GOAL);
////		
////		pnb = new PlayerNBoxes(new Position(4, 5), boxes);
////		exp.add(new Position(4,4));
////		exp.add(new Position(3,5));
////		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
////		System.out.println("17. possible moves test passed?: "+ testPossibleMovesFunction(board, pnb, exp));
////		System.out.println(" ############################ \n ");
//		
//		exp.clear();
//		boxes.clear();
//		boxes.add(new Position(1, 2));
//		boxes.add(new Position(2, 3));
//		boxes.add(new Position(1, 4));
//		board.setData(1,2,Board.GOAL);
//		board.setData(1,3,Board.GOAL);
//		board.setData(1,4,Board.GOAL);
//		board.setData(1,1,Board.WALL);
//		board.setData(1,5,Board.WALL);
//		
//		pnb = new PlayerNBoxes(new Position(3, 3), boxes);
//		exp.add(new Position(4,3));
//		exp.add(new Position(3,2));
//		exp.add(new Position(3,4));
//		exp.add(new Position(2,3));
//		System.out.print(Board.toString(Helper.joinBoards(board, pnb),8,8));
//		System.out.println("18. possible moves test passed?: "+ testPossibleMovesFunction(board, pnb, exp));
//		System.out.println(" ############################ \n ");
		
//	}
	
	public static boolean testIsItADeadLockFunction(Board board, PlayerNBoxes pnb, boolean expectedResult){
		boolean isItADeadlock = false;
		for ( int i = 0; i < pnb.getBoxesSize(); i++){
			if (  Helper.isItADeadlock(board,pnb,  pnb.getBoxes()[i]) == true){
				isItADeadlock = true;
				break;
			}
		}
		return isItADeadlock == expectedResult;
	}
	
	public static boolean testIsItADeadLockFunction(Board board, PlayerNBoxes pnb, boolean expectedResult, int boxNum){
		boolean isItADeadlock = false;
		isItADeadlock =  Helper.isItADeadlock(board,pnb,  pnb.getBoxes()[boxNum]) ;
		return isItADeadlock == expectedResult;
	}
	
	
	public static boolean testPossibleMoveBoxFunction( Board board, PlayerNBoxes pnb, ArrayList<Move> expectedResult){
		boolean re = true;
		ArrayList<Move> result = Helper.possibleMoveBox(board, pnb);
		if ( result.size() != expectedResult.size()){
			System.out.println("diffrent size: "+ result.size()+ " !=  "+expectedResult.size());
			for ( Move p : result){
				System.out.println(p);
			}
			return false;
		}
		
		for ( int i = 0; i< result.size(); i++){
			if ( !(result.get(i).isEqual(expectedResult.get(i)))){
				re = false;
			}
		}
		
		if (!re){
			for ( Move p : result){
				System.out.println(p);
			}
		}
		return re;
	}
	
	public static boolean testPossibleMovesFunction( Board board, PlayerNBoxes pnb, ArrayList<Position> expectedResult){
		boolean re = true;
//		ArrayList<Position> result = Helper.getPossibleMoves(board, pnb);
//		if ( result.size() != expectedResult.size()){
//			System.out.println("diffrent size: "+ result.size()+ " !=  "+expectedResult.size());
//			for ( Position p : result){
//				System.out.println(p);
//			}
//			return false;
//		}
//		
//		for ( int i = 0; i< result.size(); i++){
//			if ( !(result.get(i).isEqual(expectedResult.get(i)))){
//				re = false;
//			}
//		}
//		
//		if (!re){
//			for ( Position p : result){
//				System.out.println(p);
//			}
//		}
		return re;
	}
	
}
